package com.yxg.architecture.customermgr;

import com.yxg.architecture.customermgr.dao.CustomerDAO;
import com.yxg.architecture.customermgr.vo.CustomerModel;
import com.yxg.architecture.customermgr.vo.CustomerQueryModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA
 * Created By yaoxuguang
 * Date: 2018/5/7
 * Time: 12:51
 */
@Service
public class Client {
    @Autowired
    private CustomerDAO customerDAO;

    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        Client client = (Client) ctx.getBean("client");
        CustomerModel cm = new CustomerModel();
        cm.setCustomerId("c1");
        cm.setPwd("c1");
        cm.setShowName("c1");
        cm.setTrueName("张三");
        cm.setRegisterTime("111");

        client.customerDAO.create(cm);

        List<CustomerModel> list = client.customerDAO.getByCondition(new CustomerQueryModel());

        System.out.println("list == "+list);
    }
}
